home *** CD-ROM | disk | FTP | other *** search
- GWEDIT Version 2.01
- by Michael Day
- Released to the public domain
- as of 16 March 1989
-
- GWEDIT provides a graphics based string input for use with
- the Turbo Pascal BGI. The function GwRead accepts a string to be
- displayed on the screen and optionally edited.
-
- The GwRead function will optionally allow the string to be
- edited. When Edit is enabled, a cursor is simulated to indicate
- that editing can occur. In Insert mode a block cursor is shown.
- In overwrite mode a small block cursor is displayed. All of the
- normal Wordstar like editing commands are available while
- editing. If a non-editing/non-printable character is entered,
- then the GwRead function is terminated returning the character as
- the function result. This allows the calling program to analys
- the function result and determine whether to re-enter GwRead to
- continue editing, or to act upon the command.
-
- GwRead is particularly useful for database applications
- since it is ideally suited to field editing applications where
- you want to use a loop to process the data but need to optionally
- inhibit specific fields. Simply setting the Edit option to false
- will disallow the string from being edited, but still allows it
- to be displayed on the screen within the function.
-
-
- function GwRead(X,Y,Wide,CPos:integer;
- Edit:boolean;
- Color:ColorRec;
- var S:string):char;
-
-
- X,Y : Sets the X,Y pixel location on the screen where the string
- will be drawn.
-
- Wide : Sets the maximum string length allowed for editing.
-
- CPos : Sets the starting location for the cursor when editing is
- enabled.
-
- S : This is the string that gets displayed and can be edited.
-
- Color : Color specifies the colors to be used when drawing the
- the string on the screen. It also specifies how the
- string is to be displayed.
-
- Color is futher broken down into:
-
- WritePos : Specifies how the string is to be displayed
- Options are LeftWrite, RightWrite,
- CenterWrite, OffLeftWrite, and
- PoffLeftWrite
-
- FColor : this sets the foreground color of the string
- BColor : this sets the background color of the string
- BPattern : this sets the background pattern used with
- the string
-
-
- In addition to the parameters passed in the function call, there
- are four typed constants in GwEdit that control how the string
- editing occurs.
-
- ForceUpper : boolean = false;
-
- When ForceUpper is true, all lower case characters inputed will
- be converted to upper case characters. When false, no conversion
- takes place.
-
-
- InsertDefault : boolean = true;
-
- When InsertDefault is true, the Edit mode will start in insert
- mode. Insert mode can be toggled with the 'Ins' key while
- editing. When InsertDefault is false, editing will start in
- Overwrite mode.
-
-
- ClearFirstChar : boolean = true;
-
- When ClearFirstChar is true, the string that was passed will be
- cleared from the string if the first character entered is a
- displayable character. Setting this flag to false will prevent
- the string from being erased. A control R while in edit mode will
- always restore the original string to the display.
-
-
- EscapeRestore : boolean = false;
-
- When EscapeRestore is true, the original string that was passed
- to the function will be restored when the ESC key is used to exit
- the function. When false the string as it currently appears on
- the screen will be returned.
-
-
-
- Editing:
-
- In all cases, the following keys are allowed while waiting
- for key input in the string (this is regardless of the condition
- of the Edit flag:
-
- RetKey : {Accept current string and quit}
- EscKey : {Restore default string and quit}
- HomeKey : {Cursor to begin of line}
- EndKey : {Cursor to end of line}
- GwRestore : {Restore default and continue}
- GwLeft,LeftArrow : {Cursor left by one character}
- GwRight,RightArrow : {Cursor right by one character}
- GwWordLeft,CtrlLeft : {Cursor left one word}
- GwWordRight,CtrlRight : {Cursor right one word}
- BackSpace,GwRub : {Backspace one character}
- {(character delete is inhibited)}
-
- When the Edit flag is true, the following additional Edit
- controls are allowed:
-
- #32..#126: {A character to enter in the string}
- CtrlEnd : {Delete from cursor to end of line}
- CtrlHome : {Delete from beg of line to cursor}
- GwDelLine : {Delete entire line}
- GwDelChar,DelKey : {Delete current character}
- GwDelWord : {Delete word to right of cursor}
- InsKey : {Toggle insert mode}
- BackSpace,GwRub : {Backspace one character}
- {(deletes char under cursor)}
-
-
- The files in this package:
-
- GSTART.PAS
-
- GWSTART is my graphics startup unit. You can adapt it to your own
- situation if it doesn't suit you. GSTART tries to reduce the various
- display types to three common modes; CGA, EGA, or Hercules. The
- reduces the amount of hassling that has to occur between displays.
-
-
- KEYCODES.PAS
-
- KEYCODES is my standard keyboard code definition file. I use this
- unit to keep all my keyboard codes in so that they are all located
- in one place. This reduces conflicts between various programs and
- units since they all reference the KEYCODES unit.
-
-
- GCURSE.PAS
-
- GCURSE is the cursor simulation unit. It simulates a flashing
- text cursor while in graphics mode. The cursor can be inhibited,
- set to a full block cursor, or set to a small cursor.
-
-
- AREAWR.PAS
-
- AREAWR performs the actual screen writeing of text for GWEDIT.
- The routines allow you to specify an X,Y location on the screen
- to place the text, then writes the string.
-
-
- GWEDIT.PAS
-
- GWEDIT contains the graphics line editor as described in this
- documentation.
-
-
- In addition to the files mention above that are supplied with
- this unit you will also need the GRAPH.TPU and the BGI file for
- your display type. A CRT unit is also needed for the KeyPressed
- and ReadKey functions. You can either use the CRT unit provided
- with TP, or you can use any of the alternate CRT units available.
-
-
-
- The program TESTED.PAS has been provided as a quick example for
- using GWEDIT. It displays a string and then allows you to edit
- it. To exit the program press the Escape key.
-
-
-
- Using GwEdit's TFDD interface:
-
- GWEDIT includes a TFDD (Text File Device Driver) as a part of the
- unit. To use the GwEdit TFDD, just Assign it, then use the
- standard Readln and Write procedures to perform your I/O.
-
- GwEdit's assignment procedure is:
-
- AssignGwCRT(var F:Text;
- X,Y,Wide,CPos:integer;
- Edit:boolean;
- Color:ColorRec;
- var S:string);
-
-
- Parameters "X" and "Y" are the location on the screen where you
- want the string to appear (upper left corner). "Wide" is how wide
- the string area will be in character positions. "CPos" is the
- position that the cursor is to be placed initially. When "Edit"
- is true, then editing of the string is allowed. When "Edit" is
- false, editing is not allow. "Color" contains the color defintion
- for the string as described for GWEDIT above. "S" is a working
- string that is used to perform the screen writing and editing.
-
-
- An example of using the TFDD with GwEdit is shown below:
-
- AssignGwCRT(Gw,10,10,40,1,DummyColor,TS);
- Reset(Gw);
- TS := 'Edit this string';
- Readln(Gw,Rs);
-
- Ws := 'You entered: '+Rs;
- Rewrite(Gw);
- Write(Gw,Ws);
-
-
- The assignment sets the string to location 10,10 on the screen,
- sets a field width of 40 characters, places the cursor at the
- first character in the string, and uses the DummyColors for
- drawing. The Work string used is TS. Once Reset, The Work string
- is initialized to 'Edit this string' which will be displayed when
- the Readln function is called. The Readln function will display
- the string and wait for a valid completion character to be
- recieved. A valid complettion character is any non-printable
- character which is not used for editing the string. The
- completion character can be found in the global variable
- "TfddChar" which is available after calling Readln.
-
- You can use the same procedure to data to the screen by doing a
- "Rewrite" and using the "Write" procedure to write the data to
- the screen.
-
- An Example program using the TFDD functions is provided as
- TFDDTEST.PAS. You can use this program as an operational example
- for using the functions.
-
- The "Read" and "Writeln" functions are not compatible to this
- type of TFDD. You should avoid using them with the GwEdit TFDD.
-
-
- GwEdit also provides mouse support if you use a Mouse unit (see
- Mouse.Arc in the Borland library). To use the mouse support, just
- enable the mouse functions in GWEDIT, GWCURSE, and AREAWR.
-
-
-
- <eof>